Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Initial version #42

Merged
merged 3 commits into from
Nov 25, 2012

Conversation

dantleech
Copy link
Member

Not sure if this is exactly what you had in mind, but here is an initial version of a cookbook article on implementing a custom route repository -- I need to fill out the example of a custom route, as I havn't actually done this myself yet.

- Have yet to fill out the example of a custom route, as I havn't got
  round to this myself yet.
Using a custom route repository with Dynmaic Router
===================================================

The Dynamic Router allows you to customize the route Repository (i.e. the class responsible for retrieving routes from the database), and by extension, the Route objects.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we try to keep lines broken after 80-100 characters. this makes it easier to read diffs and when somebody fixes a spelling error, you have to scan just one line of < 100 characters to see what changed, instead of the whole section. to rst its all the same, a new section is only started with a blank line.

@dbu
Copy link
Member

dbu commented Nov 19, 2012

thanks a lot, good documentation. you need to add a link in the main index in the cookbook section, and i would add links in the cmf tutorial and the routing-extra reference chapters where they make sense to have people notice this cookbook exists.

class RouteRepository extends DocumentRepository implements RouteRepositoryInterface

{
public function findManyByUrl($url)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, really off topic for a doc PR, but what if we would change this to findManyByRequest and pass the whole request? i.e. symfony 2.2 supports hostnamePattern on routes, so we might want to know the hostname that was used in this request...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to suggest changing it to findByUrl so as to make it more sensible when only returning one route, but yeah, I think it makes sense to pass in the request. What about "getRouteCollectionForRequest" ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like that name. created a PR - feedback welcome: symfony-cmf/Routing#33

@dbu
Copy link
Member

dbu commented Nov 19, 2012

@dantleech can you please change the line breaks and add links? then i think we can merge this PR.

@dantleech
Copy link
Member Author

yeah sure, I will update tomorrow, I guess you realize that its incomplete as I havn't filled out the Route object, will probably get around to that this weekend.

@dantleech
Copy link
Member Author

hi, I've quickly updated. Not sure how to "backlink" to a tutorial :doc:../cookbook/foobar ? Need to take the time to setup sphinx locally. Note that this document is not finished!

@dbu
Copy link
Member

dbu commented Nov 21, 2012

yes, exactly . for example

:doc:`../bundles/routing-extra`

@dantleech
Copy link
Member Author

ok . updated and the code example should work now...

dbu added a commit that referenced this pull request Nov 25, 2012
@dbu dbu merged commit a670204 into symfony-cmf:master Nov 25, 2012
@dbu
Copy link
Member

dbu commented Nov 25, 2012

thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants